package com.hry.store.cms.controller;

import com.hry.store.cms.pojo.AdminUser;
import com.hry.store.cms.service.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class AdminUserController {
    @Autowired
    private AdminUserService adminUserService;

    /**
     * 管理员登陆
     */
    @RequestMapping(value = "user/admin/login", method = RequestMethod.POST)
    public String adminLogin(HttpServletRequest request, HttpSession session) {
        String email = request.getParameter("email");
        String password = request.getParameter("password");
        AdminUser adminUser = adminUserService.selectByEmailAndPassword(email, password);
        session.setAttribute("adminUser", adminUser);
        return "member";
    }


}
